package DataBase;

import java.sql.PreparedStatement;
import java.sql.SQLException;

public class DeleteDiscountFromTable {
	
	private String orderId;
	private int status=0;
	
	public DeleteDiscountFromTable(String orderId)
	{
		this.orderId=orderId;
	}

	
	public void deleteDiscount()
	{
       SQLConnection sc=new SQLConnection();
		
		try {
			
			PreparedStatement ps = sc.getConnection().prepareStatement("DELETE FROM discount_table WHERE  orderId=? ");	
			 ps.setString(1,orderId);
			sc.getConnection().setAutoCommit(false);
			ps.executeUpdate();
			sc.getConnection().commit();
			ps.close();
			 sc.getConnection().close();
			 status=1;
		}
		
		catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}


	public int getStatus() {
		return status;
	}


	public void setStatus(int status) {
		this.status = status;
	}
}
